"use strict";

/**
 * Config for the router
 */
angular.module("app").config([ "$routeProvider", function($routeProvider) {

	$routeProvider.when("/index", {
		templateUrl : "/article/all/tpl",
		controller : "articleListCtrl"
	}).when("/article/photo", {
		templateUrl : "/article/pic/tpl",
		controller : "articleListCtrl"
	}).when("/article/duan", {
		templateUrl : "/article/duan/tpl",
		controller : "articleListCtrl"
	}).when("/article/publish", {
		templateUrl : "/article/publish",
		controller : "articlePublishCtrl",
		uncached	:	true
	}).when("/article/publish/result/:success", {
		templateUrl : "/article/publish/result/tpl",
		controller : "articlePublishResultCtrl",
		uncached	:	true
	}).when("/user/signup", {
		templateUrl : "/user/signup"
	}).when("/user/signin", {
		templateUrl : "/user/signin"
	}).when("/help", {
		templateUrl : "/sys/help"
	}).otherwise("/index");
} ]);

/**
 * 禁止模板缓存  
 */
app.run(function($rootScope, $templateCache) {
    $rootScope.$on('$routeChangeStart', function(event, next, current) {  
        if (typeof(current) !== 'undefined' && current["$$route"].uncached){  
            $templateCache.remove(current.templateUrl);  
        }  
    });  
}); 
